package com.wuyan.locationdog.adapter

import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.LayoutRes
import com.arcsoft.commonbase.bean.DeviceBeanContent
import com.arcsoft.commonbase.ext.gone
import com.arcsoft.commonbase.ext.loadImageCircleCar
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wuyan.locationdog.R
import com.wuyan.locationdog.help.DeviceHelp


class DeviceList2Adapter(@LayoutRes layoutResId: Int, data: MutableList<DeviceBeanContent>?) :
    BaseQuickAdapter<DeviceBeanContent, BaseViewHolder>(layoutResId, data) {


    override fun convert(holder: BaseViewHolder, item: DeviceBeanContent) {
        holder.apply {
            getView<ImageView>(R.id.deviceAvatarUrl).loadImageCircleCar(item.dog?.dogImg)

            val imageView = getView<ImageView>(R.id.ivCheck)
            if (item.isSelect) {
                imageView.setImageResource(R.mipmap.alarm_checked)
            } else {
                imageView.setImageResource(R.mipmap.alarm_unchecked)
            }
            getView<TextView>(R.id.deviceName).text = DeviceHelp.getDeviceName(item)

        }
    }
}


